package com.sl.au.repository;
import java.util.Date;
import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.sl.au.entity.BussinessCheck;

public interface BussinessCheckRepository extends JpaRepository<BussinessCheck, String> {

	@Query("select b from BussinessCheck b " + "where b.businesssellerBaseInfo.shopName like %?1% "
			+ "or b.businesssellerBaseInfo.shopAdress like %?1% "
			+ "or b.businesssellerBaseInfo.managementRange like %?1% " + "or b.businesssellerBaseInfo.id like %?1%")
	Page<BussinessCheck> getCheckName(String key, Pageable pageable);
	
	@Query("select b from BussinessCheck b " + "where (b.businesssellerBaseInfo.shopName like %?1% "
			+ "or b.businesssellerBaseInfo.shopAdress like %?1% "
			+ "or b.businesssellerBaseInfo.managementRange like %?1% " + "or b.businesssellerBaseInfo.id like %?1%) and b.user.id=?2")
	Page<BussinessCheck> getCheckHistory(String key, String userId,Pageable pageable);

	@Query("select b from BussinessCheck b " + "where (b.businesssellerBaseInfo.shopName like %?1% "
			+ "or b.businesssellerBaseInfo.shopAdress like %?1% "
			+ "or b.businesssellerBaseInfo.managementRange like %?1% " + "or b.businesssellerBaseInfo.id like %?1%)")
	Page<BussinessCheck> getCheckHistory(String key,Pageable pageable);
}
